package sphere.controller;


import java.awt.Color;

import java.awt.TextField;
import java.awt.event.TextEvent;
import java.awt.event.TextListener;

import sphere.model.Sphere;
import sphere.view.SphereWindow;

public class SphereControleur implements TextListener{

    SphereWindow src;
   
    public SphereControleur(SphereWindow src){
        this.src = src;
    }
   
    public void textValueChanged(TextEvent e) {
        TextField t = (TextField)e.getSource();
        t.setBackground(Color.yellow);
        Sphere laSphere = new Sphere(Integer.parseInt(t.getText()));
        src.setSurfaceTextField(String.valueOf(laSphere.surfaceSphere()));
        src.setVolumeTextField(String.valueOf(laSphere.volumeSphere()));
    }
}